package com.fa4j.system.account.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fa4j.common.base.model.CommonState;
import com.fa4j.common.data.model.Base;
import com.fa4j.common.data.repository.handler.StringSetTypeHandler;
import com.fa4j.common.web.model.AppType;
import com.fa4j.system.account.model.entity.Operator;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.Set;

/**
 * 系统账号表
 *
 * @since 2025-05-06 16:16:26
 */
@Data
@TableName(value = "t_sys_account", autoResultMap = true)
@Schema(description = "系统账号")
public class Account extends Base implements Operator {

    @Schema(description = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "应用类型")
    private AppType appType;

    @Schema(description = "用户名")
    private String username;

    @Schema(description = "用户昵称")
    private String nickname;

    @Schema(description = "账号类型")
    private AccountType type;

    @Schema(description = "状态")
    private CommonState state;

    @Schema(description = "手机号码")
    private String phone;

    @Schema(description = "电子邮箱")
    private String email;

    @Schema(description = "头像ID")
    private Long avatarId;

    @Schema(description = "角色编码集合")
    @TableField(typeHandler = StringSetTypeHandler.class)
    private Set<String> roleCodes;

    @Schema(description = "操作人ID")
    private Long operatorId;

    @Schema(description = "头像ID地址")
    @TableField(exist = false)
    private String avatarUrl;

    @Schema(description = "操作人ID名称")
    @TableField(exist = false)
    private String operatorName;


}
